#include <iostream>
#include <string>
#include <string.h>
#include <vector>
#include <fstream>
#include <algorithm>

using namespace std;

bool Fibon_elem(int pos, uint32_t& elem);
bool print_squence(int pos);

class Stack {
public:
    bool push(const string& str);
    bool pop(string& str);
    bool empty();
    bool full();
    bool find(const string& str);
    int count(const string& str);
private:
    vector<string> vecStr;
};

class Triangular {
public:
    Triangular();
    Triangular(int len);
    Triangular(int len, int beg_pos);
    Triangular(const Triangular& rhs);
    Triangular& copy(const Triangular& rhs);
    int length() const
    {
        return _length;
    }
    int beg_pos() const
    {
        return _beg_pos;
    }
    int elem(int pos) const;
    bool next(int &val);
    void next_reset()
    {
        _next = _beg_pos - 1;
    }
private:
    int _length;
    int _beg_pos;
    int _next;
    static vector<int> _elem;
    string name;
};

class Matrix {
public:
    Matrix(int row, int col)
    {
        _row = row;
        _col = col;
        _pmat = new double[row * col];
        cout << "this is Matrix constructor" << endl;
    }
    Matrix(const Matrix& rhs):_row(rhs._row), _col(rhs._col)
    {
        int elem = _row * _col;
        _pmat = new double[elem];
        for (int i = 0; i<elem; i++) {
            _pmat[i] = rhs._pmat[i];
        }
    }
    ~Matrix()
    {
        delete[] _pmat;
        cout << "this is Matrix destructor" << endl;
    }
private:
    int _row;
    int _col;
    double* _pmat;
};

class LibMat {
public:
    LibMat();
    ~LibMat();
    virtual void show() const;
};

class Book : public LibMat {
public:
    Book(const string& title, const string& author)
    {
        _title = title;
        _author = author;
        cout << "Book::Book(" << _title << ", " << _author << ") constructor" << endl;
    }
    ~Book()
    {
        cout << "Book::~Book() destructor" << endl;
    }
    virtual void show() const
    {
        cout << "Book::print() ---i am a Book object" << endl;
        cout << "My title is " << _title << endl;
        cout << "My author is " << _author << endl;
    }
    const string& title() const
    {
        return _title;
    }
    const string& author() const
    {
        return _author;
    }
private:
    string _title;
    string _author;
};